<!--
/**
* Author: ganqz
* Date: 2021-12-07 16:17
* Desc: ProductItem
*/
-->
<template>
  <view
    :style="customStyle"
    :class="customClass"
    class="product-item"
    @click="handleClick"
  >
    <view class="mb15">
      {{ item.name }}
    </view>
    <form-item title="券码:" :value="item.code"></form-item>
    <form-item title="补差:" v-if="item.diffData && item.diffData.diffMoney">
      <text class="red">{{ item.diffData.diffMoney }}元</text>
    </form-item>
  </view>
</template>

<script lang="ts">
  import { codeItemType } from '@/@type'
  import FormItem from '@/components/FormItem/index.vue'
  import styleMixins from '@/mixins/styleMixins'
  import { Mixins, Component, Prop, Emit } from 'vue-property-decorator'
  @Component({
    name: 'ProductItem',
    components: { FormItem }
  })
  export default class ProductItem extends Mixins(styleMixins) {
    @Prop(Object) item!: codeItemType
    @Emit('click')
    handleClick(e) {
      return e
    }
  }
</script>

<style lang="scss" scoped>
  .product-item {
    padding: 22rpx;
    border: 1px solid #e2e2e2;
    border-radius: 10rpx;
  }
</style>
